]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
dateMenu: Limit timezone offset hours to integers
authorRaghuveer Kasaraneni <raghu@kasara.net>
Mon, 21 Mar 2022 18:24:25 +0000 (19:24 +0100)
committerMarge Bot <marge-bot@gnome.org>
Mon, 21 Mar 2022 19:29:11 +0000 (19:29 +0000)
If the timezone offset calculation in the World Clocks contains non-zero
minutes, then a decimal Hours value is being displayed. Limit the Hours value
to integers by using Math.floor().

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2255>

js/ui/dateMenu.js

index 71b932ad71b4063a6bed3ff0a2b1f8e70fe28888..ca98cdd248b1e27bcc929e5628c4e847d30c78d7 100644 (file)
@@ -467,7 +467,8 @@ class WorldClocksSection extends St.Button {
         const localOffset = GLib.DateTime.new_now_local().get_utc_offset();
         const utcOffset = GLib.DateTime.new_now(tz).get_utc_offset();
         const offsetCurrentTz = utcOffset - localOffset;
-        const offsetHours = Math.abs(offsetCurrentTz) / GLib.TIME_SPAN_HOUR;
+        const offsetHours =
+            Math.floor(Math.abs(offsetCurrentTz) / GLib.TIME_SPAN_HOUR);
         const offsetMinutes =
             (Math.abs(offsetCurrentTz) % GLib.TIME_SPAN_HOUR) /
             GLib.TIME_SPAN_MINUTE;